<template>
  <div class="app-tasklist-toolbar">
    <div class="portlet-title">
      <div class="task float-left" style="margin-right:533px">
        <span>
          任务
        </span>
        <v-btn small outlined @click="changeDisplayModel()" class="addtask"
          >添加任务</v-btn
        >
      </div>
      <div class="float-right">
        <v-menu v-model="menu" offset-y :close-on-content-click="false">
          <template v-slot:activator="{ on, attrs }">
            <v-btn depressed small color="white" v-bind="attrs" v-on="on">
              <i class="fa fa-filter fa-lg fa-fw"></i>
              <span style="color:grey">筛选</span>
            </v-btn>
          </template>
          <view_searchform @search="searchform_search" :context="context"></view_searchform>
        </v-menu>

        <v-menu offset-y :close-on-content-click="false">
          <template v-slot:activator="{ on, attrs }">
            <v-btn depressed small color="white" v-bind="attrs" v-on="on">
              <i class="fa fa-clone fa-fw"></i>
              <span style="color:grey">按清单分组</span>
            </v-btn>
          </template>
          <view_searchform></view_searchform
        ></v-menu>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import {
  Vue,
  Component,
  Prop,
  Model,
  Emit,
  Watch,
  Provide,
} from "vue-property-decorator";

import "./app-tasklist-toolbar.less";
import ProjectService from "@/service/project/project-service";

import view_searchform from "@widgets/task/default-searchform/default-searchform.vue";

@Component({
  components: {
    view_searchform,
  },
})
export default class AppTasklistToolbar extends Vue {
  public menu: any = false;

  @Prop() public context:any;

  /**
   * 是否显示编辑表单
   *
   * @event click
   * @param {number}
   * @memberof AppNavMenu
   */
  public changeDisplayModel(index: any) {
    this.$emit("changedisplaymodel", {});
  }

  /**
     * searchform 部件 search 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof TaskListViewBase
     */
    public searchform_search(val:any) {
      Object.assign(val,{'n_project_eq':this.context.project})
        this.$emit('search',val)
    }
}
</script>
